package com.hsnn.medstgmini.settlement.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.hsnn.medstgmini.util.FormatDate;
import com.hsnn.medstgmini.util.ParseNumber;

/**
 * @category 账户收支信息
 * @author 韩守松
 * @date 2015年7月21日
 */
@Entity
@Table(name = "set_accttransinfo")
public class SetAcctTransInfo implements Serializable {
	/**
	 * 序列号
	 */
	private static final long serialVersionUID = 7701091185481486056L;

	private String transId;// 收支信息id
	private String orgId;// 账户id（机构id）
	private Integer transType;// 收支类型1收2支3取消
	private Double amount;// 发生额
	private String amountStr;// 格式化发生额
	private Date transDatetime;// 发生时间
	private String transDatetimeStr;// 格式化发生时间
	private Double outstandAmt;// 账户余额
	private String outstandAmtStr;// 格式化账户余额
	private String remark;// 备注
	private Date updDatetime;// 更新时间
	private String updDatetimeStr;// 格式化更新时间
	private String updUser;// 更新人

	private Date staTime;// 开始时间
	private Date endTime;// 结束时间

	@Id
	@Column(name = "trans_id", length = 36)
	public String getTransId() {
		return transId;
	}

	public void setTransId(String transId) {
		this.transId = transId;
	}

	@Column(name = "org_id", length = 36)
	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	@Column(name = "trans_type", length = 36)
	public Integer getTransType() {
		return transType;
	}

	public void setTransType(Integer transType) {
		this.transType = transType;
	}

	@Column(name = "amount", length = 36)
	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	@Column(name = "trans_datetime", length = 36)
	public Date getTransDatetime() {
		return transDatetime;
	}

	public void setTransDatetime(Date transDatetime) {
		this.transDatetime = transDatetime;
	}

	@Column(name = "outstand_amt", length = 36)
	public Double getOutstandAmt() {
		return outstandAmt;
	}

	public void setOutstandAmt(Double outstandAmt) {
		this.outstandAmt = outstandAmt;
	}

	@Column(name = "remark", length = 36)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "upd_datetime", length = 36)
	public Date getUpdDatetime() {
		return updDatetime;
	}

	public void setUpdDatetime(Date updDatetime) {
		this.updDatetime = updDatetime;
	}

	@Column(name = "upd_user", length = 36)
	public String getUpdUser() {
		return updUser;
	}

	public void setUpdUser(String updUser) {
		this.updUser = updUser;
	}

	@Transient
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	public Date getStaTime() {
		return staTime;
	}

	public void setStaTime(Date staTime) {
		this.staTime = staTime;
	}

	@Transient
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Transient
	public String getAmountStr() {
		if (amount != null) {
			amountStr = ParseNumber.toStrDecimal(amount);
		}
		return amountStr;
	}

	public void setAmountStr(String amountStr) {
		this.amountStr = amountStr;
	}

	@Transient
	public String getOutstandAmtStr() {
		if (outstandAmt != null) {
			outstandAmtStr = ParseNumber.toStrDecimal(outstandAmt);
		}
		return outstandAmtStr;
	}

	public void setOutstandAmtStr(String outstandAmtStr) {
		this.outstandAmtStr = outstandAmtStr;
	}

	@Transient
	public String getTransDatetimeStr() {
		if (transDatetime != null) {
			transDatetimeStr = FormatDate.toFullFormat(transDatetime);
		}
		return transDatetimeStr;
	}

	public void setTransDatetimeStr(String transDatetimeStr) {
		this.transDatetimeStr = transDatetimeStr;
	}

	@Transient
	public String getUpdDatetimeStr() {
		if (updDatetime != null) {
			updDatetimeStr = FormatDate.toFullFormat(updDatetime);
		}
		return updDatetimeStr;
	}

	public void setUpdDatetimeStr(String updDatetimeStr) {
		this.updDatetimeStr = updDatetimeStr;
	}

}